﻿<TextBox x:Class="SyntaxHighlight.SyntaxHighlightTextBox"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:SyntaxHighlight"
    xmlns:a="clr-namespace:System;assembly=mscorlib">
    <TextBox.Template>
        <ControlTemplate TargetType="local:SyntaxHighlightTextBox">
            <Border BorderThickness="{TemplateBinding Border.BorderThickness}" BorderBrush="{TemplateBinding Border.BorderBrush}" 
                  Name="Bd" SnapsToDevicePixels="True" >
                <Grid Background="Transparent">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="{Binding Path = LineNumberMarginWidth, RelativeSource={RelativeSource Templatedparent}, Mode=OneWay}" />
                        <ColumnDefinition  Width ="*"/>
                    </Grid.ColumnDefinitions>

                    <ScrollViewer Name="PART_ContentHost" SnapsToDevicePixels="{TemplateBinding UIElement.SnapsToDevicePixels}" Grid.Column="1" />
                    <Border Grid.Column="0" BorderThickness="0 0 1 0" BorderBrush="{TemplateBinding LineNumberBrush}" Margin="0,0,4,0"/>
                    <Canvas Grid.Column="1" Background="Transparent" IsHitTestVisible="True">
                        <ListBox Name="suggestionList" Canvas.Top="10" Canvas.Left="40" Height="150">
                            <ListBoxItem>Test</ListBoxItem>
                            <ListBoxItem>Test2</ListBoxItem>
                            <ListBoxItem>Test3</ListBoxItem>
                        </ListBox>
                    </Canvas>
                </Grid>
            </Border >
            <ControlTemplate.Triggers>
                <Trigger Property="UIElement.IsEnabled">
                    <Setter Property="Panel.Background" TargetName="Bd">
                        <Setter.Value>
                            <DynamicResource ResourceKey="{x:Static SystemColors.GrayTextBrushKey}" />
                        </Setter.Value>
                    </Setter>
                    <Setter Property="TextElement.Foreground">
                        <Setter.Value>
                            <DynamicResource ResourceKey="{x:Static SystemColors.GrayTextBrushKey}" />
                        </Setter.Value>
                    </Setter>
                    <Trigger.Value>
                        <a:Boolean>False</a:Boolean>
                    </Trigger.Value>
                </Trigger>
            </ControlTemplate.Triggers>
        </ControlTemplate>

    </TextBox.Template>
</TextBox>
